package Thread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.BlockingQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-08-05
 * Time: 21:27
 */
public class demo25 {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new ArrayBlockingQueue<String>(1);//参数表示容量
        queue.put("A");
        System.out.println("put成功");
        queue.take();
        System.out.println("take成功");
        queue.take();
        System.out.println("take成功");
    }
    public static void main1(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new ArrayBlockingQueue<String>(4);//参数表示容量
        queue.put("A");
        System.out.println("put成功");
        queue.put("A");
        System.out.println("put成功");
        queue.put("A");
        System.out.println("put成功");
        queue.put("A");
        System.out.println("put成功");
        queue.put("A");
        System.out.println("put成功");
    }
}
